<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;

class Order extends Model
{
    protected $table='order';
    protected $primaryKey='order_id';
    protected $fillable=[
        'user_id','order_sn','sum_price','receive_id','order_status','trade_no','out_trade_no','pay_type','use_integral','pay_time','send_time','success_time'
        ,'receive_type','note','freight','back_integral'
    ];
    public function my_info()
    {
        return $this->hasMany(OrderInfo::class,'order_id','order_id');
    }

    public function my_receive()
    {
        return $this->hasOne(UserReceiveAddr::class,'receive_addr_id','receive_id');
    }

    public function my_user()
    {
        return $this->hasOne(User::class,'user_id','user_id');
    }
}
